fixed and enabled performance-faster-string-find clang-tidy warning#4769
fixed and enabled performance-faster-string-find clang-tidy warning#4769danmar merged 1 commit intocppcheck-opensource:mainfrom
performance-faster-string-find clang-tidy warning#4769Conversation
|
Intuitivitely it should be faster. Do you have some measurement? I don't think such micro optimisations will make any big difference. I think the focus should be rewriting algorithms to make it faster. |
|
I attached links to benchmarks. There's no way to make the algorithm faster. It's a suboptimal implementation in the standard, In the matchcompiler we optimize |
We get more and more micro optimisations... it's not good and it gets worse and worse. I don't want to unroll all the micro optimisations we made at this point. But if we can stop making more it would make me feel better. I am not strongly against this particular PR we can reluctantly merge this now. I don't feel there is any payoff. I wonder how I can stop the focus on micro optimisations. I would assume that we can rewrite parser code and get significant speedups. |
|
Well the speed-up is above a micro optimization if it delivers a performance of 1.8. The linked benchmark is measuring actual time and not instruction count. Which is what we actually should be profiling for. This is just an easy "win" compared with the other stuff I did. And we have tooling to support use with. Just "rewriting" parsers and other things will lead to actual micro-optimizations like I am already trying to find ways to get rid of the matchcompiler and have the compilers behave better with common patterns. |
Ok thanks I did not see that benchmark. However I assume the difference in Cppcheck analysis time will be very small. Maybe micro optimisations are more OK in the matchcompiler output. If there is something we can safely do. Whatever it means to readability does not matter then.
I agree
In my opinion you are not talking about "rewriting" then. I am not talking about rearranging code to avoid cache misses.
I agree. We need to be much more careful in the ValueFlow. |
I am learning and improving my approaches as well as refining my Cppcheck and LLVM tickets.
I took a short look at cache misses and we have buckets of them. They primarily seem to be related to lambda usage but I couldn't really figure out where exactly. I am just not familiar with cache profiling. But it might also be some shortcomings because we cannot move variables into lambdas yet.
I would really love if the compiler would just generate optimal code for |
|
I will do some before and after profiling of these changes still. |
|
Good news. |
Another long overdue try to get this applied.
Here's some actual benchmarks this time:
https://quick-bench.com/q/K1KmsDawQ4PpwwAMTqHdprlZeUU
https://quick-bench.com/q/zEJnrbF5gPaa1o7d32oQzu8UeU8